-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support xz format for template registration #11786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #11786 +/- ##
=============================================
- Coverage 17.50% 3.60% -13.90%
=============================================
Files 5894 442 -5452
Lines 526880 37265 -489615
Branches 64338 6836 -57502
=============================================
- Hits 92243 1345 -90898
+ Misses 424260 35757 -388503
+ Partials 10377 163 -10214
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@blueorangutan package |
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15279 |
@blueorangutan test |
@harikrishna-patnala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian Build Failed (tid-14524) |
@blueorangutan package |
@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for xz-compressed templates across utilities, KVM adaptors, and shell scripts to enable template registration and extraction of .xz files.
- Extend compression format detection to include xz
- Add extraction logic for .xz in KVM adaptors and shell scripts
- Update unit tests to cover xz handling
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
utils/src/main/java/com/cloud/utils/UriUtils.java | Adds "xz" to COMPRESSION_FORMATS for URL detection. |
utils/src/test/java/com/cloud/utils/UriUtilsTest.java | Adds a positive assertion for xz URLs. |
utils/src/test/java/com/cloud/utils/UriUtilsParametrizedTest.java | Removes ".xz" from illegal formats; tests configuration updated. |
tools/devcloud4/common/development-installation/files/default/createtmplt.sh | Adds XZ detection and decompression in helper script. |
scripts/storage/secondary/createvolume.sh | Adds XZ detection and decompression. |
scripts/storage/secondary/createtmplt.sh | Adds XZ detection and decompression. |
scripts/storage/qcow2/createvolume.sh | Adds XZ decompression. |
scripts/storage/qcow2/createtmplt.sh | Adds XZ decompression. |
scripts/installer/createvolume.sh | Adds XZ decompression. |
scripts/installer/createtmplt.sh | Adds XZ decompression. |
plugins/storage/volume/storpool/src/main/java/com/cloud/hypervisor/kvm/storage/StorPoolStorageAdaptor.java | Adds xz to extractable types and extraction command. |
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java | Adds xz to extractable types and extraction command. |
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/MultipathSCSIAdapterBase.java | Adds xz to extractable types and extraction command. |
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java | Adds xz to extractable types and extraction command. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
} else if (downloadedTemplateFile.endsWith(".gz")) { | ||
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else if (downloadedTemplateFile.endsWith(".xz")) { | ||
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else { | ||
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isTemplateExtractable() treats ZIP as extractable, but getExtractCommandForDownloadedFile() has no branch for ".zip", which will cause ZIP files to hit the exception path. Add ZIP handling consistent with other scripts, for example: return "unzip -p " + downloadedTemplateFile + " > " + templateFile;
Copilot uses AI. Check for mistakes.
} else if (downloadedTemplateFile.endsWith(".gz")) { | ||
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else if (downloadedTemplateFile.endsWith(".xz")) { | ||
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else { | ||
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZIP is considered extractable in isTemplateExtractable(), but there is no extraction branch for ".zip" here. Add ZIP extraction support to avoid throwing for valid ZIP templates, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateFile;
Copilot uses AI. Check for mistakes.
} else if (downloadedTemplateFile.endsWith(".gz")) { | ||
return "gunzip -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else if (downloadedTemplateFile.endsWith(".xz")) { | ||
return "xz -d -c " + downloadedTemplateFile + " > " + templateFile; | ||
} else { | ||
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZIP is allowed by isTemplateExtractable(), but ".zip" is not handled here, leading to an exception for ZIP templates. Add a ZIP case similar to other formats, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateFile;
Copilot uses AI. Check for mistakes.
} else if (downloadedTemplateFile.endsWith(".gz")) { | ||
return "gunzip -c " + downloadedTemplateFile + " > " + templateUuid; | ||
} else if (downloadedTemplateFile.endsWith(".xz")) { | ||
return "xz -d -c " + downloadedTemplateFile + " > " + templateUuid; | ||
} else { | ||
throw new CloudRuntimeException("Unable to extract template " + downloadedTemplateFile); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZIP archives are flagged as extractable in isTemplateExtractable(), but there is no handling for ".zip" here, which will cause a runtime exception. Add a ZIP branch, e.g., return "unzip -p " + downloadedTemplateFile + " > " + templateUuid;
Copilot uses AI. Check for mistakes.
;; | ||
[zZ][iI][pP]) unzip -p $1 | cat > $tmpfile | ||
;; | ||
XZ) xz -d -c $1 > $tmpfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a case sensitive check. Use [xX][zZ]
to match xz
, XZ
, xZ
& Xz
.
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 15319 |
Description
This PR enables support for xz format templates #7701
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?